<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui">

<h:head>
</h:head>

<f:view
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core">
    <f:event type="preRenderView" listener="#{logosUserViewMB.showResult}"/>
</f:view>

<p:ajaxStatus onstart="statusDialog.show();"
	onsuccess="statusDialog.hide();" />

<p:dialog modal="true" widgetVar="statusDialog" header="buscando..."
	draggable="false" closable="false">
	<p:graphicImage value="resources/images/ajaxloadingbar.gif" />
</p:dialog>

<h:body>
	<h1>Resultado: #{logosUserViewMB.question}</h1>
	<p:outputPanel id="resultContainer" rendered="true">
		<h:form prependId="false">
			<p:pieChart id="pieChart" lazy="true"
				value="#{logosUserViewMB.questionResultView.pieModel}"
				legendPosition="w" title="Resposta(s)"
				style="width:400px;height:300px;border:none">
				<p:ajax event="itemSelect" listener="#{logosUserViewMB.itemSelect}"  global="true" update=":resultContainer"/>
			</p:pieChart>
		</h:form>			
	
	 <p:dataTable id="dataTable" var="site" value="#{logosUserViewMB.questionResultView.showedSites}"
	 			 rendered="#{logosUserViewMB.questionResultView.showedSites != null}"  
                 paginator="true" rows="10"  
                 paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"  
                 >  
        <p:column>  
                <h:outputText value="#{site}" />  
        </p:column>
        <p:column>  
        	<h:outputText value="#{logosUserViewMB.getDetails(site)}" />  
        </p:column>    
            
    </p:dataTable>  	
		
		
	</p:outputPanel>

</h:body>
</html>